


class PluginInfo():
    def __init__(self, name, plugin, data):
        self.plugin_name = name
        self.plugin_data = data
        self.plugin = plugin;
        

class PluginModel():
    def __init__(self):
        self.plugins = {}
    
    def AddPlugin(self, name, plugin, data):
        self.plugins[name] = PluginInfo(name, plugin, data)
    
    def RemovePlugin(self, plugin_name):
        del self.plugins[plugin_name]
    
    def GetPluginInfo(self, plugin_name):
        return self.plugins[plugin_name]
        
    def GetPluginData(self, plugin_name):
        return self.plugins[plugin_name].plugin_data
    
    def GetPlugin(self, plugin_name):
        return self.plugins[plugin_name].plugin

    '''Reimplement this if need'''
    def NotifyPlugin(self, param = None):
        for plugin_info in self.plugins.itervalues():
            plugin_info.plugin.OnPluginNotify(param)
    
    